package ro.uaic.info.fmse.context.transformers.generic;
import java.util.HashSet;
import java.util.Set;

import ro.uaic.info.fmse.context.transformers.items.MyCloneable;
public class NodeVisitor<T extends MyCloneable> {
	private Set<Node<T>> nodes;
	private Set<Edge<T>> edges;
	
	public NodeVisitor() {
		this.nodes = new HashSet<Node<T>>();
		this.edges = new HashSet<Edge<T>>();
	}
	
	public void visit(Node<T> node) {
//		System.out.println("VISIT: " + node.label + "\n\n");
		// add the node to nodes
		nodes.add(node);
		// add the edges
		if (node.parent != null)
			edges.add(new Edge<T>(node.parent, node));
	}
	
	public Set<Node<T>> getNodes() {
		return nodes;
	}
	
	public Set<Edge<T>> getEdges() {
		return edges;
	}
}